package itheima.d09;

import java.time.Instant;

public class Test {
    public static void main(String[] args) {
        //获取当前的时间
        Instant now = Instant.now();
        //获取总秒数
        long totalSeconds = now.getEpochSecond();
        System.out.println("总秒数："+totalSeconds);
        //获取纳秒数
        long nano = now.getNano();
        System.out.println("纳秒数："+nano);

        //加减时间，判断时间的先后
        Instant plus = now.plusSeconds(1000);
        System.out.println("1000秒后的时间："+plus);

        //记录操作时间
        Instant now1 = Instant.now();
        System.out.println("操作时间："+now1);
        System.out.println("操作耗时："+(Instant.now().toEpochMilli()-now1.toEpochMilli()));

        //记录程序运行时间
        Instant start = Instant.now();
        System.out.println("程序开始运行时间："+start);
        Instant end = Instant.now();
        System.out.println("程序结束运行时间："+end);
        System.out.println("程序运行耗时："+(end.toEpochMilli()-start.toEpochMilli()));
    }
}
